#include "gtest/gtest.h"
#include "Spatial.h"

USING_NS_B2D

TEST(test_spatial, test_local_world_conversion)
{
	Spatial transform;
	transform.setPosition(2,2);
	transform.setRotation(Maths::PI_HALF);

	const vec2 p(4,2);

	const vec2 actual_l2w = transform.localToWorld(p);
	const vec2 actual_w2l = transform.worldToLocal(p);
	const ivec2 expected_l2w(0,6);
	const ivec2 expected_w2l(0,-2);

	EXPECT_EQ(expected_l2w, ivec2(round(actual_l2w.x), round(actual_l2w.y)));
	EXPECT_EQ(expected_w2l, ivec2(round(actual_w2l.x), round(actual_w2l.y)));
}